<#-- 导入变量定义文件 -->
<#include "../template/include/assign.ftl">
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>消息管理</title>
<#-- 导入静态资源文件 -->
<#include "../template/include/source.ftl">
<link href="${web_static}/admin/css/list.css" rel="stylesheet" type="text/css" />
<style type="text/css">
	.page{
		float:right;
		padding-top: 15px;
		margin-right: 15px;
	}
</style>
</head>
<#include "../template/template_listPage.ftl">
<script type="text/javascript">
	$().ready( function() {
		<#if actionErrors??&&(actionErrors?size > 0)>
			$.dialog({type: "warn", content: "<#list errorMessages as list>${list}<br></#list>",
			 modal: true, autoCloseTime: 3000});
		</#if>
		
			$('.follow-cursor').poshytip({
                    className: 'tip-darkgray',
	                followCursor: true,
	                slide: false
                });
	
	}); 


function deleteM(mid){
	var submit = function (v, h, f) {
                if (v == 'ok')  {
                    var url="${web_base}/go/message!falseDelete.htm?messageId="+mid;
                    document.forms[0].action=url;
					document.forms[0].submit();
                }  else if (v == 'cancel')  {

                }
                return true; //close
            };
     $.jBox.confirm("你确认要删除吗?", "温罄提示", submit);
 }
</script>
</head>
<body class="list">
	<div class="body">
		<div class="listBar">
			<h1><span class="icon">&nbsp;</span>消息管理&nbsp;<span class="pageInfo"></span></h1>
		</div>
		<@pageList page=(page!) id="listForm" action="${web_base}/go/message!list.htm" query="messageInfoQuery" isEmpty=true>
			<div class="operateBar">
			<input type="button" class="addButton" onclick="location.href='${web_base}/go/message!input.htm'" value="发送消息" />
			<label>查找:</label>
				消息标题:<input type="text" id="" name="messageInfoQuery.messageTitle" value="${(messageInfoQuery.messageTitle)!}" /> 
				发送时间:
				 <input type="text" id="startTime" name="messageInfoQuery.sendTimeStart"
                    onclick="WdatePicker({startDate:'%y',dateFmt:'yyyy-MM-dd HH:mm:ss',maxDate:'#F{$dp.$D(\'endTime\')||\'%y-%M-%d\'}'})"
                           value="${(messageInfoQuery.sendTimeStart?string("yyyy-MM-dd HH:mm:ss"))!}" class="Wdate fixWidth" >
			<span>--</span><input type="text" id="endTime" name="messageInfoQuery.sendTimeEnd"
                   onclick="WdatePicker({startDate:'%y',dateFmt:'yyyy-MM-dd HH:mm:ss',minDate:'#F{$dp.$D(\'startTime\')}',maxDate:'%y-%M-%d'})"
                   value="${(messageInfoQuery.sendTimeEnd?string("yyyy-MM-dd HH:mm:ss"))!}" class="Wdate fixWidth">
                <input type="hidden" name="messageInfoQuery.orderBy" id="orderBy" value="${messageInfoQuery.orderBy}" />
				<input type="hidden" name="messageInfoQuery.orderType" id="order" value="${messageInfoQuery.orderType}" />
				<input type="submit" id="searchButton" class="searchButton" value="" />
			</div>
			<table class="listTable">
				<tr>
					<th>
						<span class="" >消息标题</span>
					</th>
					<th>
						<span class="" >发送时间</span>
					</th>
					<th width="30%">
						<span class="">消息内容</span>
					</th>
					<th>
						<span class="">目标客户</span>
					</th>
					<th width="80">操作<th/>
				</tr>
				<#if  page??&&page.list??&&(page.list?size gt 0) >			
				<#list page.list as obj>
					<tr>
						<td>
							<a class="follow-cursor" title="${(obj.messageTitle)!}" style="cursor: pointer;">
	                            <#if obj.messageTitle??>
	                            <#--//截取输出文字的长度-->
	                                    <#if obj.messageTitle?length lte 10 >
	                                    	${(obj.messageTitle)!}
	                                    <#else>
	                                    ${obj.messageTitle?substring(0,10)}...
	                                    </#if>
	                            </#if>
	                        </a>
						</td>
						<td>
							 <#if obj.sendTime?exists&&obj.sendTime?is_date>
								${(obj.sendTime)?string("yyyy-MM-dd HH:mm:ss")}
							</#if>
						</td>
						<td width="40%">
							 <a class="follow-cursor" title="${(obj.messageContent)!}" style="cursor: pointer;">
	                            <#if obj.messageContent??>
	                            <#--//截取输出文字的长度-->
	                                    <#if obj.messageContent?length lte 10 >
	                                    	${(obj.messageContent)!}
	                                    <#else>
	                                    	${obj.messageContent?substring(0,10)}...
	                                    </#if>
	                            </#if>
	                        </a>
						</td>
						<td>
							<#if obj.messageType?? && obj.messageType=="1">
                                      全体用户                                    
                            <#elseif obj.messageType?? && obj.messageType=="0"> 
                               		<#if obj.targetCustomer?? >
			                        <#list obj.targetCustomer as target>
			                            ${(target.customerId)!} 
			                        </#list>
			                      </#if>
                            <#elseif obj.messageType?? && obj.messageType=="2">      
                            	<#if obj.targetCustomer?size < 3>
                                    <#list obj.targetCustomer as target>
                                            <#if target_index<3>
                                                ${(target.customerId)!}<br/>
                                            </#if>
                                    </#list>
                                <#else>
                                            ${(obj.targetCustomer[0].customerId)!}<br/>
                                            ${(obj.targetCustomer[1].customerId)!}<br/>
                                            ${(obj.targetCustomer[2].customerId)!}<br/>
                                            ......
                                </#if>
							</#if>
						</td>
						<td width="80">
						    	<span class="spanLink" onclick="deleteM('${(obj.messageId)!}')" title="删除">[删除]</span>
						</td>
					</tr>
				</#list>
				<#else>
				    <tr><td colspan="11">
					<div class="noRecord">
						没有找到任何记录!
					</div>	
					</td>
					</tr>
				</#if>	
			</table>
		</@pageList>
	</div>
</body>
</html>